<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //得到一个两数之间的随机整数，包括两个数在内
        /*  function getRandomIntInclusive(min, max) {
             min = Math.ceil(min);
             max = Math.floor(max);
             return Math.floor(Math.random() * (max - min + 1)) + min; //含最大值，含最小值
         } */
        //54张牌，两张王，13♣ ♦ ♥ ♠ 
        function getRandomIntInclusive(min, max) {
            min = Math.ceil(min);
            max = Math.floor(max);
            return Math.floor(Math.random() * (max - min + 1)) + min; //含最大值，含最小值
        }
        let zong = ['♠A', '♠2', '♠3', '♠4', '♠5', '♠6', '♠7', '♠8', '♠9', '♠10', '♠J', '♠Q', '♠K', '♥A', '♥2', '♥3',
            '♥4', '♥5', '♥6', '♥7', '♥8', '♥9', '♥0', '♥J', '♥Q', '♥K', '♣A', '♣2', '♣3', '♣4', '♣5', '♣6', '♣7',
            '♣8', '♣9', '♣10', '♣J', '♣Q', '♣K', '♦A', '♦2', '♦3', '♦4', '♦5', '♦6', '♦7', '♦8', '♦9', '♦10', '♦J',
            '♦Q', '♦K', '🃏l', '🃏b'
        ];
        console.log(zong);

        function random(num1) {
            let num = [];
            let brand1 = [];
            let j = 0;
            for (var i = 0; i < num1; i++) {
                num[i] = getRandomIntInclusive(1, 54);
                var newArr = new Array();
                for (var k = 0; k <= num.length; k++) {
                    if (newArr.indexOf(num[k]) == -1) {
                        newArr.push(num[k]);  
                        
                    }else{
                        --i;
                        break;
                    }
                }

            }
            for (var temx of newArr) {
                brand1[j++] = zong[temx];
            }
            return brand1;
        }

        let cards = random(3);
        console.log(`底牌为  ${cards}`);
        let farmer1 = random(17);
        console.log(`农民1  ${farmer1}`);
        let farmer2 = random(17);
        console.log(`农民2  ${farmer2}`);
        let landowner = random(17);
        console.log(`地主  ${landowner}`);
    </script>
</body>

</html>